home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Musik / Conv / Lame / USAGE < prev   
Encoding:
Text File  |  2000-05-08  |  19.4 KB  |  589 lines

  1.  
  2. % lame [options] inputfile [outputfile]
  3.  
  4. =======================================================================
  5. Examples:
  6. =======================================================================
  7. fixed bit rate jstereo 128kbs encoding:
  8. % lame sample.wav  sample.mp3      
  9.  
  10. fixed bit rate jstereo 128kbs encoding, highest quality:  (recommended)
  11. % lame -h sample.wav  sample.mp3      
  12.  
  13. To disable joint stereo encoding (slightly faster, but less quality at bitrates<=128kbs)
  14. % lame -m s sample.wav  sample.mp3     
  15.  
  16. Fast encode, low quality  (no psycho-acoustics)
  17. % lame -f sample.wav  sample.mp3     
  18.  
  19. Variable Bitrate (VBR): (use -V n to adjust quality/filesize)
  20. % lame -h -v sample.wav sample.mp3
  21.  
  22. Note: VBR is currently under heavy development.  Right now it can
  23. often result in too much compression.  I would recommend using VBR
  24. with a minimum bitrate of 112kbs.  This will let LAME increase
  25. the bitrate for difficult-to-encode frames, but prevent LAME from
  26. being too aggressive for simple frames:
  27.  
  28. % lame -h -v -b 112  sample.wav sample.mp3
  29.  
  30.  
  31. =======================================================================
  32. LOW BITRATES
  33. =======================================================================
  34. At lower bitrates, (like 24kbs per channel), it is recommended that
  35. you use a 16kHz sampling rate combined with lowpass filtering.  LAME,
  36. as well as commercial encoders (FhG, Xing) will do this automatically.
  37. However, if you feel there is too much (or not enough) lowpass
  38. filtering, you may need to try different values of the lowpass cutoff
  39. and passband width (--lowpass and --lowpass-width options).
  40.  
  41.  
  42.  
  43.  
  44. =======================================================================
  45. STREAMING EXAMPLES
  46. =======================================================================
  47. Streaming mono 22.05kHz raw pcm, 24kbs output:
  48. % cat inputfile | lame -r -m m -b 24 -s 22.05 - - > output
  49.  
  50. Streaming mono 22.05kHz raw pcm, with downsampling to 16kHz:
  51. % cat inputfile | sox -t raw -x -w -s -c 1 -r 22050 -  -t raw -x -w -s -c 1 -r 16000 - resample 0.66 | lame -r -m m -b 24 -s 16 - - > output
  52.  
  53. You may or may not need one or both of the "-x" (swap bytes) option in Sox.  
  54.  
  55.  
  56.  
  57.  
  58. =======================================================================
  59.  
  60. For more options, just type:
  61. % lame --help
  62.  
  63. Scripts are included to run lame on multiple files:
  64.  
  65. bach script:  mlame     Run "mlame -h" for instructions.
  66. sh script:    auenc     Run auenc for instructions
  67.  
  68.  
  69.  
  70. =======================================================================
  71. options guide:
  72. =======================================================================
  73. These options are explained in detail below.
  74.  
  75.  
  76. Quality related:
  77.  
  78. -m m/s/j/f     mode selection
  79. -k             disable all filtering
  80. -d             allow block types to differ between channels
  81. --athonly      ignore psy-model output, only use masking from the ATH
  82. --voice        experimental voice encoding mode
  83. --noshort      disable short blocks
  84.  
  85.  
  86. Constant Bit Rate (CBR)
  87. -b  n          set bitrate (8,16,24,...,320)
  88. -h             higher quality but slower
  89. -f             disable psycho-acoustics.  Encoding much faster but lower quality
  90. --freeformat   produce a free format bitstream.  User must also specify
  91.                a bitrate with -b, between 8 and 320 kbs.
  92.  
  93. Variable Bit Rate (VBR)
  94. -v             VBR
  95. -V n           VBR quality setting  (0=highest quality, 9=lowest)
  96. -b  n          specify a minimum allowed bitrate (8,16,24,...,320)
  97. -B  n          specify a maximum allowed bitrate (8,16,24,...,320)
  98. -F             strictly enforce minimum bitrate
  99. -t             disable Xing VBR informational tag 
  100. --nohist       disable display of VBR bitrate histogram
  101.  
  102.  
  103. Experimental (undocumented):  may work better or worse:
  104.  
  105. -X n           try different quality measures (when comparing quantizations)
  106. -Y             
  107. -Z             
  108.  
  109.  
  110. Operational:
  111.  
  112. -r             assume input file is raw PCM
  113. --decode       assume input file is an mp3 file, and decode to raw pcm.  
  114. -s  n          input sampling frequency in kHz (for raw PCM input files)
  115. --resample n   output sampling frequency
  116. --mp3input     input file is an MP3 file.  decode using mpglib/mpg123
  117. -x             swap bytes of input file
  118. -a             downmix stereo input file to mono .mp3
  119. -e  n/5/c      de-emphasis
  120. -p             add CRC error protection
  121. -c             mark the encoded file as copyrighted
  122. -o             mark the encoded file as a copy
  123. -S             don't print progress report, VBR histogram
  124. -g             run MP3x, the graphical frame analyzer
  125. --strictly-enforce-ISO   comply as much as possible to ISO MPEG spec
  126.  
  127.  
  128. id3 tagging:
  129.  
  130. --tt "title"     title of song (max 30 chars)
  131. --ta "artist"    artist who did the song (max 30 chars)
  132. --tl "album"     album where it came from (max 30 chars)
  133. --ty "year"      year in which the song/album was made (max 4 chars)
  134. --tc "comment"   additional info (max 30 chars)
  135. --tg "genre"     genre of song (name or number)
  136.  
  137.  
  138.  
  139. options not yet described:
  140. --nores            disable bit reservoir
  141. --noath            disable ATH
  142. --cwlimit <freq>   specify range of tonality calculation
  143.  
  144. --lowpass
  145. --lowpass-width
  146. --highpass
  147. --highpass-width
  148.  
  149.  
  150.  
  151.  
  152.  
  153. =======================================================================
  154. Detailed description of all options in alphabetical order
  155. =======================================================================
  156.  
  157.  
  158. =======================================================================
  159. downmix
  160. =======================================================================
  161. -a  
  162.  
  163. mix the stereo input file to mono and encode as mono.  
  164.  
  165. This option is only needed in the case of raw PCM stereo input 
  166. (because LAME cannot determine the number of channels in the input file).
  167. To encode a stereo PCM input file as mono, use "lame -m s -a"
  168.  
  169. For WAV and AIFF input files, using "-m m" will always produce a
  170. mono .mp3 file from both mono and stereo input.
  171.  
  172. =======================================================================
  173. ATH only
  174. =======================================================================
  175. --athonly
  176.  
  177. This option causes LAME to ignore the output of the psy-model and
  178. only use masking from the ATH.  Might be useful at very high bitrates
  179. or for testing the ATH.  
  180.  
  181.  
  182.  
  183.  
  184. =======================================================================
  185. bitrate
  186. =======================================================================
  187. -b  n
  188.  
  189. For MPEG1 (sampling frequencies of 32, 44.1 and 48kHz)
  190. n =   32,40,48,56,64,80,96,112,128,160,192,224,256,320
  191.  
  192. For MPEG2 (sampling frequencies of 16, 22.05 and 24kHz)
  193. n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160
  194.  
  195.  
  196. The bitrate to be used.  Default is 128kbs MPEG1, 80kbs MPEG2.
  197.  
  198. When used with variable bitrate encodings (VBR), -b specifies the
  199. minimum bitrate to use.  This is useful to prevent LAME VBR from
  200. using some very aggressive compression which can cause some distortion
  201. due to small flaws in the psycho-acoustic model.
  202.  
  203. =======================================================================
  204. max bitrate
  205. =======================================================================
  206. -B  n
  207.  
  208. For MPEG1 (sampling frequencies of 32, 44.1 and 48kHz)
  209. n =   32,40,48,56,64,80,96,112,128,160,192,224,256,320
  210.  
  211. For MPEG2 (sampling frequencies of 16, 22.05 and 24kHz)
  212. n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160
  213.  
  214. Maximum allowed bitrate when using VBR.
  215.  
  216.  
  217. =======================================================================
  218. copyright
  219. =======================================================================
  220. -c   
  221.  
  222. mark the encoded file as copyrighted
  223.  
  224.  
  225.  
  226. =======================================================================
  227. block type control
  228. =======================================================================
  229. -d 
  230.  
  231. Allows the left and right channels to use different block types.
  232. Normally this is not allowed, only because the FhG encoder does
  233. not seem to allow it either.  If anyone finds a sample where -d
  234. produces better results, let me know.  (mt@sulaco.org)
  235.  
  236.  
  237. =======================================================================
  238. mpglib decode capability
  239. =======================================================================
  240. --decode 
  241.  
  242. This just uses LAME's mpg123/mpglib interface to decode an MP3 file to
  243. a raw pcm file.  The input file must be an MP3 file, and the raw pcm
  244. data will be written to the output file in native endian format.
  245. Under linux, on i386, to convert the output file to a wav, use:
  246.  
  247. % lame --decode input.mp3 output.pcm
  248. % sox -c 2 -t raw -r 44100 -s -w output.pcm output.wav
  249.  
  250. (assuming output.pcm came from a stereo, 44.1khz mp3 file)
  251.  
  252.  
  253.  
  254. =======================================================================
  255. de-emphasis
  256. =======================================================================
  257. -e  n/5/c   
  258.  
  259.   n = (none, default)
  260.   5 = 0/15 microseconds
  261.   c = citt j.17
  262.  
  263. All this does is set a flag in the bitstream.  If you have a PCM
  264. input file where one of the above types of (obsolete) emphasis has
  265. been applied, you can set this flag in LAME.  Then the mp3 decoder
  266. should de-emphasize the output during playback, although most 
  267. decoders ignore this flag.
  268.  
  269. A better solution would be to apply the de-emphasis with a standalone
  270. utility before encoding, and then encode without -e.  
  271.  
  272.  
  273.  
  274. =======================================================================
  275. fast mode
  276. =======================================================================
  277. -f   
  278.  
  279. disable psycho-acoustics.  Encoding much faster but lower quality
  280.  
  281. =======================================================================
  282. strictly enforce VBR minimum bitrate
  283. =======================================================================
  284. -F   
  285.  
  286. strictly enforce VBR minimum bitrate.  With out this optioni, the minimum
  287. bitrate will be ignored for passages of analog silence.
  288.  
  289.  
  290.  
  291. =======================================================================
  292. free format bitstreams
  293. =======================================================================
  294. -freeformat   
  295.  
  296. LAME will produce a fixed bitrate, free format bitstream.
  297. User must specify the desired bitrate in kbs, which can
  298. be any integer between 8 and 320.
  299.  
  300. Not supported by many decoders.  
  301.  
  302.  
  303. =======================================================================
  304. graphical frame analyzer
  305. =======================================================================
  306. -g
  307.  
  308. run MP3x, the graphical frame analyzer analysis on the inputfile.  The
  309. inputfile can be either an .mp3 file or uncompressed audio file.  MP3x
  310. support must be compiled into LAME, and requires GTK 1.2.
  311. Documentation is under the About pull down menu.
  312.  
  313.  
  314.  
  315. =======================================================================
  316. high quality
  317. =======================================================================
  318. -h
  319.  
  320. use (maybe) some quality improvements
  321.  
  322. LAME 3.21 and up:  -h enables specialized mid/side masking thresholds to
  323. be used in jstereo mode.  Will sound better in jstereo mode
  324. but is 20% slower.  No effect for mono files.
  325.  
  326. LAME 3.58beta and up: -h also enables a more accurate but slightly
  327. slower quantization formula.  
  328.  
  329.  
  330.  
  331. =======================================================================
  332. sfb=21 cutoff
  333. =======================================================================
  334. -k   
  335.  
  336. keep all frequencies.  (Disable all filters)
  337.  
  338. Without -k, LAME will automatically apply various types of lowpass
  339. filters.  This is because the high frequency coefficients can take up
  340. a lot of bits that would be better used for lower, more important
  341. frequencies.
  342.  
  343.  
  344.  
  345.  
  346. =======================================================================
  347. Modes:
  348. =======================================================================
  349.  
  350. -m m           mono.  
  351. -m s           stereo
  352. -m j           jstereo
  353. -m f           forced mid/side stereo
  354.  
  355. mono is the default mode for mono input files.  If "-m m" is specified
  356. for a stereo input file, the two channels will be averaged into a mono
  357. signal.  
  358.  
  359. jstereo is the default mode for stereo files with fixed bitrates of
  360. 128kbs or less.  At higher fixed bitrates, the default is stereo.
  361. For VBR encoding, jstereo is the default for VBR_q >4, and stereo
  362. is the default for VBR_q <=4.  You can override all of these defaults
  363. by specifing the mode on the command line.  
  364.  
  365. jstereo means the encoder can use (on a frame by frame bases) either
  366. regular stereo (just encode left and right channels independently)
  367. or mid/side stereo.  In mid/side stereo, the mid (L+R) and side (L-R)
  368. channels are encoded, and more bits are allocated to the mid channel
  369. than the side channel.  This will effectively increase the bandwidth
  370. if the signal does not have too much stereo separation.  
  371.  
  372. Mid/side stereo is basically a trick to increase bandwidth.  At 128kbs,
  373. it is clearly worth while.  At higher bitrates it is less usefull.  
  374.  
  375. Using mid/side stereo inappropriately can result in audible
  376. compression artifacts.  To much switching between mid/side and regular
  377. stereo can also sound bad.  To determine when to switch to mid/side
  378. stereo, LAME uses a much more sophisticated algorithm than that
  379. described in the ISO documentation.
  380.  
  381. -m f forces all frames to be encoded mid/side stereo.  It 
  382. should only be used if you are sure every frame of the input file
  383. has very little stereo seperation.  
  384.  
  385.  
  386.  
  387. =======================================================================
  388. MP3 input file
  389. =======================================================================
  390. --mp3input
  391.  
  392. Assume the input file is a MP3 file.  Usefull for downsampling from
  393. one mp3 to another.  If the filename ends in ".mp3" LAME will assume
  394. it is an MP3.  For stdin or MP3 files which dont end in .mp3 you need
  395. to use this switch.
  396.  
  397.  
  398. =======================================================================
  399. disable historgram display
  400. =======================================================================
  401. --nohist
  402.  
  403. By default, LAME will display a bitrate histogram while producing
  404. VBR mp3 files.  This will disable that feature.
  405.  
  406.  
  407. =======================================================================
  408. disable short blocks
  409. =======================================================================
  410. --noshort
  411.  
  412. Encode all frames using long blocks.
  413.  
  414.  
  415.  
  416. =======================================================================
  417. non-original
  418. =======================================================================
  419. -o   
  420.  
  421. mark the encoded file as a copy
  422.  
  423.  
  424. =======================================================================
  425. CRC error protection
  426. =======================================================================
  427. -p  
  428.  
  429. turn on CRC error protection.  
  430. Yes this really does work correctly in LAME.  However, it takes 
  431. 16 bits per frame that would otherwise be used for encoding.
  432.  
  433.  
  434.  
  435. =======================================================================
  436. input file is raw pcm
  437. =======================================================================
  438. -r  
  439.  
  440. Assume the input file is raw pcm.  Sampling rate and mono/stereo/jstereo
  441. must be specified on the command line.  Without -r, LAME will perform
  442. several fseek()'s on the input file looking for WAV and AIFF headers.
  443.  
  444. Not supported if LAME is compiled to use LIBSNDFILE.
  445.  
  446.  
  447.  
  448. =======================================================================
  449. output sampling frequency in kHZ
  450. =======================================================================
  451. --resample  n
  452.  
  453. where n = 16, 22.05, 24, 32, 44.1, 48
  454.  
  455. Output sampling frequency.  Resample the input if necessary.  
  456.  
  457. If not specified, LAME may sometimes resample automatically 
  458. when faced with extreme compression conditions (like encoding
  459. a 44.1khz input file at 16kbs).  
  460.  
  461.  
  462.  
  463. =======================================================================
  464. sampling frequency in kHZ
  465. =======================================================================
  466. -s  n
  467.  
  468. where n = sampling rate in kHz.
  469.  
  470. Required for raw PCM input files.  Otherwise it will be determined
  471. from the header information in the input file.
  472.  
  473. LAME will automatically resample the input file to one of the
  474. supported MP3 samplerates if necessary.
  475.  
  476.  
  477. =======================================================================
  478. silent operation
  479. =======================================================================
  480. -S
  481.  
  482. don't print progress report
  483.  
  484.  
  485. =======================================================================
  486. strict ISO complience
  487. =======================================================================
  488. --strictly-enforce-ISO   
  489.  
  490. With this option, LAME will enforce the 7680 bit limitation on
  491. total frame size.  This results in many wasted bits for
  492. high bitrate encodings.
  493.  
  494.  
  495. =======================================================================
  496. disable Xing VBR tag
  497. =======================================================================
  498. -t              
  499.  
  500. Disable writing of the Xing VBR Tag (only valid if -v flag is
  501. specified) This tag in embedded in frame 0 of the MP3 file.  It lets
  502. VBR aware players correctly seek and compute playing times of VBR
  503. files.
  504.  
  505.  
  506.  
  507. =======================================================================
  508. variable bit rate  (VBR)
  509. =======================================================================
  510. -v
  511.  
  512. Turn on VBR.  There are several ways you can use VBR.  I personally
  513. like using VBR to get files slightly bigger than 128kbs files, where
  514. the extra bits are used for the occasional difficult-to-encode frame.
  515. For this, try specifying a minimum bitrate to use with VBR:
  516.  
  517. lame -v -b 112  input.wav output.mp3
  518.  
  519. If the file is too big, use -V n, where n=0..9
  520.  
  521. lame -v -V n   -b 112  input.wav output.mp3
  522.  
  523.  
  524. If you wan to use VBR to get the maximum compression possible,
  525. and for this, you can try:  
  526.  
  527. lame -v  input.wav output.mp3
  528. lame -v -V n input.wav output.mp3         (to very quality/filesize)
  529.  
  530.  
  531.  
  532.  
  533. =======================================================================
  534. VBR quality setting
  535. =======================================================================
  536. -V n       
  537.  
  538. n=0..9.  Specifies the value of VBR_q.  default=4.  0=highest quality.
  539.  
  540.  
  541.  
  542. How is VBR_q used?
  543.  
  544. OVER = number of scalefactor bands with distortion that exceeds the
  545. allowed distortion given by the masking thresholds.  OVER is computed
  546. by outer_loop, and the masking thresholds are computed by the
  547. psycho-acoustic model. 
  548.  
  549. VBR_q = the minimum value of OVER which is to be allowed.
  550. LAME will choose the smallest bitrate for which OVER <= VBR_q.  
  551. (a minimum allowed bitrate can be set with -b.  default=64kbs)
  552.  
  553. If the frame contains short blocks, then the minimum bitrate is made
  554. much larger since the OVER does not adequately measure distortion
  555. caused by pre-echo.  LAME uses bitrates of at least 160kbs for short
  556. blocks to make sure they sound good.
  557.  
  558. *NOTE* No psy-model is perfect, so there can often be distortion which
  559. is audible even though the psy-model claims it is not!  Thus using a
  560. small minimum bitrate can result in some aggressive compression and
  561. audible distortion even with -V 0.  Thus using -V 0 does not sound
  562. better than a fixed 256kbs encoding.  For example: suppose in the 1kHz
  563. frequency band the psy-model claims 20db of distortion will not be
  564. detectable by the human ear, so LAME VBR-0 will compress that
  565. frequency band as much as possible and introduce at most 20db of
  566. distortion.  Using a fixed 256kbit framesize, LAME could end up
  567. introducing only 2db of distortion.  If the psy-model was correct,
  568. they will both sound the same.  If the psy-model was wrong, the VBR-0
  569. result can sound worse.
  570.  
  571.  
  572. =======================================================================
  573. voice encoding mode
  574. =======================================================================
  575. --voice
  576.  
  577. An experimental voice encoding mode.  Tuned for 44.1kHz input files.
  578.  
  579.  
  580. =======================================================================
  581. swapbytes   
  582. =======================================================================
  583. -x
  584.  
  585. swap bytes in the input file.  for sorting out little endian/big endian
  586. type problems.  If your encodings sound like static, try this first.
  587.  
  588.  
  589.